﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using Visifire.Gauges;

namespace CPPEI.Coolzon.UI.DataPartLib
{
    public partial class DataGaugeLinearScale
    {
        public LinearScale SetLinearScale(LinearScale linearScale)
        {
            linearScale.BorderBrush = LinearBorderBrush==null? null : LinearBorderBrush.Brush;
            linearScale.BorderThickness = LinearBorderThickness;
            linearScale.Background = LinearBackground==null? null : LinearBackground.Brush;
            linearScale.Interval = LinearInterval ?? Double.NaN;
            linearScale.Logarithmic = LinearLogarithmic;
            linearScale.LogarithmBase = LinearLogarithmBase;
            linearScale.Maximum = LinearMaximum;
            linearScale.Minimum = LinearMinimum;
            linearScale.Prefix = LinearPrefix;
            linearScale.ScalingSet = LinearScalingSet;
            linearScale.ShadowEnabled = LinearShadowEnabled;
            linearScale.Suffix = LinearSuffix;
            linearScale.ToolTipText = LinearToolTipText;

            linearScale.ScaleThickness = LinearScaleThickness;
            linearScale.StartMargin = LinearStartMargin;
            linearScale.EndMargin = LinearEndMargin;
            if (IsHorizontal)
                linearScale.Orientation = System.Windows.Controls.Orientation.Horizontal;
            else
                linearScale.Orientation = System.Windows.Controls.Orientation.Vertical;

            if (LinearPositionX != null && LinearPositionY != null && LinearPositionX.Value >= 0 && LinearPositionX.Value <= 1 && LinearPositionY.Value >= 0 && LinearPositionY.Value <= 1)
                linearScale.Position = new Point(LinearPositionX.Value, LinearPositionY.Value);
            else
                linearScale.Position = null;

            linearScale.ThermometerBulbOffset = LinearThermometerBulbOffset;
            linearScale.ThermometerBulbSize = LinearThermometerBulbSize;

            return linearScale;
        }
        private BrushEx linearBorderBrush;
        private Thickness linearBorderThickness;
        private BrushEx linearBackground;
        private double? linearInterval;
        private bool linearLogarithmic;
        private int linearLogarithmBase;
        private double? linearMaximum;
        private double? linearMinimum;
        private string linearPrefix;
        private string linearScalingSet;
        private bool linearShadowEnabled;
        private string linearSuffix;
        private string linearToolTipText;

        private double? linearScaleThickness;
        private double linearStartMargin;
        private double linearEndMargin;
        private bool linearIsHorizontal;
        private double? linearPositionX;
        private double? linearPositionY;
        private double linearThermometerBulbOffset;
        private double linearThermometerBulbSize;

        public bool IsHorizontal
        {
            get; set;
        }

        [Category("标尺")]
        [DisplayName("标尺边框颜色")]
        [Description("LinearBorderBrush")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearBorderBrush", "标尺边框颜色")]
        public BrushEx LinearBorderBrush
        {
            get
            {
                return linearBorderBrush;
            }

            set
            {
                linearBorderBrush = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺边框大小")]
        [Description("LinearBorderThickness")]
        [Editor(typeof(UI.XProperty.Editors.XThicknessEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearBorderThickness", "标尺边框大小")]
        public Thickness LinearBorderThickness
        {
            get
            {
                return linearBorderThickness;
            }

            set
            {
                linearBorderThickness = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺背景颜色")]
        [Description("LinearBackground")]
        [Editor(typeof(UI.XProperty.Editors.XBrushEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearBackground", "标尺背景颜色")]
        public BrushEx LinearBackground
        {
            get
            {
                return linearBackground;
            }

            set
            {
                linearBackground = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺步长")]
        [Description("LinearInterval")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearInterval", "标尺步长")]
        public double? LinearInterval
        {
            get
            {
                return linearInterval;
            }

            set
            {
                linearInterval = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺是否对数显示")]
        [Description("LinearLogarithmic")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearLogarithmic", "标尺是否对数显示")]
        public bool LinearLogarithmic
        {
            get
            {
                return linearLogarithmic;
            }

            set
            {
                linearLogarithmic = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺对数显示基数")]
        [Description("LinearLogarithmBase")]
        [Editor(typeof(UI.XProperty.Editors.XIntEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearLogarithmBase", "标尺对数显示基数")]
        public int LinearLogarithmBase
        {
            get
            {
                return linearLogarithmBase;
            }

            set
            {
                linearLogarithmBase = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺最大值")]
        [Description("LinearMaximum")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearMaximum", "标尺最大值")]
        public double? LinearMaximum
        {
            get
            {
                return linearMaximum;
            }

            set
            {
                linearMaximum = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺最小值")]
        [Description("LinearMinimum")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearMinimum", "标尺最小值")]
        public double? LinearMinimum
        {
            get
            {
                return linearMinimum;
            }

            set
            {
                linearMinimum = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺前缀")]
        [Description("LinearPrefix")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearPrefix", "标尺前缀")]
        public string LinearPrefix
        {
            get
            {
                return linearPrefix;
            }

            set
            {
                linearPrefix = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺缩放")]
        [Description("LinearScalingSet")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearScalingSet", "标尺缩放")]
        public string LinearScalingSet
        {
            get
            {
                return linearScalingSet;
            }

            set
            {
                linearScalingSet = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺是否显示阴影")]
        [Description("LinearShadowEnabled")]
        [Editor(typeof(UI.XProperty.Editors.XBooleanEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearShadowEnabled", "标尺是否显示阴影")]
        public bool LinearShadowEnabled
        {
            get
            {
                return linearShadowEnabled;
            }

            set
            {
                linearShadowEnabled = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺后缀")]
        [Description("LinearSuffix")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearSuffix", "标尺后缀")]
        public string LinearSuffix
        {
            get
            {
                return linearSuffix;
            }

            set
            {
                linearSuffix = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺提示")]
        [Description("LinearToolTipText")]
        [Editor(typeof(UI.XProperty.Editors.XStringEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearToolTipText", "标尺提示")]
        public string LinearToolTipText
        {
            get
            {
                return linearToolTipText;
            }

            set
            {
                linearToolTipText = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺宽度")]
        [Description("LinearScaleThickness")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearScaleThickness", "标尺宽度")]
        public double? LinearScaleThickness
        {
            get
            {
                return linearScaleThickness;
            }

            set
            {
                linearScaleThickness = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺起始偏移量")]
        [Description("LinearStartMargin")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearStartMargin", "标尺起始偏移量")]
        public double LinearStartMargin
        {
            get
            {
                return linearStartMargin;
            }

            set
            {
                linearStartMargin = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺结束偏移量")]
        [Description("LinearEndMargin")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearEndMargin", "标尺结束偏移量")]
        public double LinearEndMargin
        {
            get
            {
                return linearEndMargin;
            }

            set
            {
                linearEndMargin = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺位置X(0-1)")]
        [Description("LinearPositionX")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearPositionX", "标尺位置X(0-1)")]
        public double? LinearPositionX
        {
            get
            {
                return linearPositionX;
            }

            set
            {
                linearPositionX = value;
                Refresh();
            }
        }
        [Category("标尺")]
        [DisplayName("标尺位置Y(0-1)")]
        [Description("LinearPositionY")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleNullEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearPositionY", "标尺位置Y(0-1)")]
        public double? LinearPositionY
        {
            get
            {
                return linearPositionY;
            }

            set
            {
                linearPositionY = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺起始距温度计球偏移量")]
        [Description("LinearThermometerBulbOffset")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearThermometerBulbOffset", "标尺温度计球偏移量")]
        public double LinearThermometerBulbOffset
        {
            get
            {
                return linearThermometerBulbOffset;
            }

            set
            {
                linearThermometerBulbOffset = value;
                Refresh();
            }
        }

        [Category("标尺")]
        [DisplayName("标尺温度计球大小")]
        [Description("LinearThermometerBulbSize")]
        [Editor(typeof(UI.XProperty.Editors.XDoubleEditor), typeof(UI.XProperty.XPropertyValueEditor))]
        [XProperty(XPropertyCategory.Other, "LinearThermometerBulbSize", "标尺温度计球大小")]
        public double LinearThermometerBulbSize
        {
            get
            {
                return linearThermometerBulbSize;
            }

            set
            {
                linearThermometerBulbSize = value;
                Refresh();
            }
        }
    }
}
